package com.bestcem.xm.user.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 套餐版本
 *
 * @author wangyunyun <yunyun.wang@idiaoyan.com>
 * @version v1.0
 * @date 2022/3/10 17:15
 */
@Getter
@AllArgsConstructor
public enum PackageTypeEnum {

    FREE(0, "基础版'"),
    FREE_TRIAL(1, "基础试用版"),
    SENIOR(2, "高级版"),
    MAJOR(3, "专业版"),
    FLAGSHIP(4, "旗舰版"),
    OTHER(5, "其他版本"),
    ;

    private final Integer type;

    private final String desc;

    /**
     * 通过type获取
     *
     * @param type
     * @return
     */
    public static PackageTypeEnum getByType(Integer type) {
        if (type != null) {
            for (PackageTypeEnum value : values()) {
                if (value.getType().equals(type)) {
                    return value;
                }
            }
        }
        return null;
    }

}
